package com.wider.servlet;

public class AppletHTML {
	private String TagString;
	
	
	
	public AppletHTML(){
		TagString  = "<object classid='clsid:8AD9C840-044E-11D1-B3E9-00805F499D93' width=##WIDTH## height=##HEIGHT##>";
		TagString += "<param name='code' value='##CLASSNAME##'>";
		TagString += "<param name='codebase' value='##CODEBASE##'>";
		TagString += "<param name='archive' value='##ARCHIVE##'>";
		TagString += "##OBJ_OPTIONS##";
		TagString += "<comment><embed width=##WIDTH## height=##HEIGHT## code='##CLASSNAME##' codebase='##CODEBASE##' archive='##ARCHIVE##' ##EBD_OPTIONS## type='application/x-java-applet'><noembed>No Java Support.</noembed></embed></comment>";
		TagString += "</object>";
	}
	
	public void SetAppletClass(String AppletClassName){
		TagString = TagString.replace("##CLASSNAME##", AppletClassName);
	}
	
	public void SetAppletCodebase(String AppletCodebase){
		TagString = TagString.replace("##CODEBASE##", AppletCodebase);
	}
	
	public void SetAppletArchive(String AppletArchive){
		TagString = TagString.replace("##ARCHIVE##", AppletArchive);
	}
	
	public void SetAppletSize(int width, int height){
		TagString = TagString.replace("##WIDTH##", String.valueOf(width));
		TagString = TagString.replace("##HEIGHT##", String.valueOf(height));
	}
	
	public void SetParameter(String ParamName, String ParamValue){
		TagString = TagString.replace("##OBJ_OPTIONS##", "<param name='" + ParamName +"' value='" + ParamValue +"'>");
		TagString = TagString.replace("##EBD_OPTIONS##", " " + ParamName + "='" + ParamValue +"' ");
	}
	
	public void EndOptions(){
		TagString = TagString.replace("##OBJ_OPTIONS##", "");
		TagString = TagString.replace("##EBD_OPTIONS##", "");
	}
	
	public String toString(){
		return TagString;
	}
}
